<h3>文章列表</h3>
<style type="text/css">
  .cates li{ float:left; list-style:none;padding:5px;}
</style>
<ul class="cates">
  <% @cate.each do |item| %>
    <li><%=link_to_remote item.name,:url=>article_category_articles_path(item),:method=>:get,:update=>"list" %></li>
<% end %>
</ul>

<div >
  <% form_remote_tag :url=>search_article_result_path,:id=>"serach",:method=>:get,:update=>"list" do -%>
    <%= text_field_tag "title",params[:title] ,:class=>"search_text",:id=>"search_key" %>
    <input type="submit" value="资讯快搜" class="search_buttom" id="query"/>
  <% end -%>
</div>
<br/>

<% javascript_tag do -%>
  $("#query").click(function(){
  if($("#search_key").val()=="")
  {
    alert("请输入要查找的关键字！");
    return false;
  }
  });
<% end -%>

<br/><br/>
<div id="list">
<table>
  <tr>
    <th>标题</th>
   
    <th>排序</th>
    <th>出处</th>
    <th>简短描述</th>
    <th>是否推荐</th>
    <th>关键词</th>
    <th>点击数</th>
    <th>形像图片</th>
  </tr>

<% for article in @articles %>
  <tr>
    <td><%=h article.title %></td>
    
    <td><%=h article.article_order %></td>
    <td><%=h article.come_from %></td>
    <td><%=truncate(h(article.short_description),:length=>18) %></td>
    <td><%=h article.recommend %></td>
    <td><%=h article.key_word %></td>
    <td><%=h article.click_count %></td>
    <td><%= image_tag article.image_name ? "newsimgs/"+article.image_name : "no_image.png",:size=>"30x30" %></td>
    <td><%= link_to 'Edit', edit_article_category_article_path(article.article_category_id,article) %></td>
    <td><%= link_to 'Destroy', article_category_article_path(article.article_category_id,article), :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>
<%= will_paginate @articles %>
</div>
<br />

<%= link_to 'New article', new_article_category_article_path %>
<fieldset class="demo">
  <LEGEND>操作说明：</LEGEND>
  <p>
    文章列表

  </p>
</fieldset>
